Overview
This set of scripts lets you manage Windows Firewall rules for specific .exe files. Choose to block or remove firewall rules for .exe files in the same directory as the script, enhancing system security.
Prerequisites
- For Windows operating systems.
- Administrative privileges to manage Windows Firewall rules.
- Familiarity with running scripts on Windows.
Choose a Script
Two options:
1. Batch Script (.bat)
Simple and user-friendly. Name: fw_rule_manager.bat
.
2. PowerShell Script (.ps1)
Offers advanced functionality. Name: fw_rule_manager.ps1
.
How It Works
Batch Script (.bat)
- Detects the script's directory.
- Asks to block or remove firewall rules.
- Adds outbound and inbound rules to block or removes existing rules for each .exe file.
PowerShell Script (.ps1)
- Gets the script's directory.
- Asks to block or remove firewall rules.
- Adds outbound and inbound rules to block or removes existing rules for each .exe file.
How to Use
Batch Script (.bat)
- Download
fw_manager.bat
.
- Save it in the directory with .exe files.
- Run by double-clicking or command prompt.
- Choose Action: 1 to block, 2 to remove.
- Script Execution: Auto-detects and processes .exe files.
- Done: Displays "Done" and pauses for review.
PowerShell Script (.ps1)
- Download
fw_manager.ps1
.
- Save it anywhere.
- Run in PowerShell with admin privileges.
- Navigate to script's directory (if needed).
- Execute with
.\fw_manager.ps1
.
- Choose Action: 1 to block, 2 to remove.
- Script Execution: Auto-detects and processes .exe files.
- Done: Displays "Done."
Flowchart
graph LR
subgraph main
A[Start] --> B[Get Script Directory]
B --> C[Ask User Action]
C --> D[Block Rules]
C --> E[Remove Rules]
end
subgraph loop
D --> J
E --> J
J[user choice]
J --> F[Display Status]
F --> G[Next .exe File]
G --> K{any left?}
K -- yes --> J
end
subgraph done
K -- no --> H[Script Completed]
H --> I[Done]
end
Disclaimer
- Use these scripts responsibly with necessary permissions.
- Caution when modifying firewall rules; it affects network access for applications.